package com.xinggq.pay.api.feign;

import com.xinggq.common.CommonResult;
import com.xinggq.pay.api.dto.YseCommonPayPespDTO;
import com.xinggq.pay.api.dto.YseCommonPayReqDTO;
import com.xinggq.pay.api.dto.YseCommonRefundReqDTO;
import com.xinggq.pay.api.dto.YseCommonRefundRespDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 支付服务Feign客户端
 * @author xinggq
 * @since 2025-01-20
 */
@FeignClient(name = "pay-service", path = "/api/yse", fallback = YsePayServiceClientFallback.class)
public interface YsePayServiceClient {

    /**
     * 统一支付接口 - 推荐使用
     * @param yseCommonPayReqDTO 统一支付参数
     * @return 支付结果
     */
    @PostMapping("/pay")
    CommonResult<YseCommonPayPespDTO<?>> pay(@RequestBody YseCommonPayReqDTO yseCommonPayReqDTO);

    /**
     * 支付回调
     * @param ysePayNotifyStr
     * @return
     */
    @PostMapping("/pay/callback")
    String payCallback(@RequestBody String ysePayNotifyStr);


    /**
     * 退款回调
     * @param yseRefundNotifyStr
     * @return
     */
    @PostMapping("/refund/callback")
    String refundCallback(@RequestBody String yseRefundNotifyStr);


    /**
     * 退款
     */
    @PostMapping("/refund")
    CommonResult<YseCommonRefundRespDTO> refund(@RequestBody YseCommonRefundReqDTO refundDTO);

}